<?php
/**
 * 点赞
 */
namespace Wap\Controller;
use Wap\BaseController;
use Common\Model\PraiseModel;
class PraiseController extends BaseController {
    public function index(){
        die;
    }

    //点赞页面
    public function praise(){
        $type=I('get.type',0,'int');
        $id=I('get.id',0,'int');

        $uid = session("uid")+0;
        //是否当日首次签到
        signAssignWap($uid,$this->smarty);

        $this->smarty->assign('title',C('SITE_NAME'));
        $this->smarty->assign('objType',$type);
        $this->smarty->assign('objID',$id);
        $this->smarty->display("Praise/praiseList.html");
    }

    //加载更多
    public function loadMore(){
        $page = I('get.page',2,'intval');
        $type = I('get.type',0,'intval');
        $id = I('get.id',0,'intval');
        if(!$id || !$type){
            $this->ajaxReturn(array('status'=>0, 'dataHTML'=>'没有数据'));
        }

        $praiseList=PraiseModel::getPraiseList($type,$id,$page,$pageSize=20);

        $this->smarty->assign('list',$praiseList['list']);
        $html=$this->smarty->fetch('Praise/praiseListItem.html');
        $this->ajaxReturn(array('status'=>0, 'dataHTML'=>$html, 'isPage'=>$praiseList['nextPage']));
    }
}